-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve readability of brew upgrade
#6436
Conversation
Personally I prefer the prior output even although I agree it's not ideal with extremely large numbers of packages. @Homebrew/maintainers: thoughts? |
I think the latter might be nicer. I don't have a strong opinion about either one. |
Sorted output is what many other package managers (conda, yum) do. I find it a lot more readable. |
I prefer the latter (one per line), though I find the order of upgrading more important than alphabetical — in case of failure failure or requiring an interruption, it’s easier to know what was already done. |
Could we add some flag that allows us to format it as described above or even make it silently? |
I'd prefer sorted, and |
I prefer sorted by name (or possibly order of installation), and a mild preference for one per line. |
As the I'd keep the current format (which is compact and fairly readable when updating often), if it doesn't exceed a few lines (say 3), and switch to line-by-line beyond that. |
I feel that switching the formatting conditionally is not worth the effort, and I'd prefer a consistent output format. |
@sjackman I don't think effort is a problem here (looks like it would just be a one-liner). However, I do agree with you on the consistent format. |
I think the proposed changes (1 package per line) are easier to read. A flag or environment variable to sort alphabetically or topo-sorted by dependency/update order would be nice, but if we have to pick only one, then I would say keep existing sorting on update-order/dependency topo-sort as it's trivial to pipe the output into the The only drawback I see is that if someone doesn't set their terminal scrollback history/buffer to be long enough they may lose the beginning of the output if there is an absurdly large number of packages to upgrade... |
Library/Homebrew/cmd/upgrade.rb
Outdated
@@ -98,14 +98,14 @@ def upgrade | |||
else | |||
verb = args.dry_run? ? "Would upgrade" : "Upgrading" | |||
oh1 "#{verb} #{formulae_to_install.count} outdated #{"package".pluralize(formulae_to_install.count)}:" | |||
formulae_upgrades = formulae_to_install.map do |f| | |||
formulae_upgrades = formulae_to_install.sort.map do |f| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the .sort
here? Will keep the \n
below though. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done :)
@MikeMcQuaid Just realized i forgot to squash the commits. It is rebased now. |
Perfect! |
brew style
with your changes locally?brew tests
with your changes locally?Hi, this is just a small cosmetic change that I find useful.
When upgrading lots of packages at the same time, the list of packages can be hard to read due to the length of the list and the fact that most terminals by default do their line breaks exactly when the line is full and not on word endings. This often leads to chopped up package names and versions. It is not easy to quickly find a package at a glance.
For example, on my machine:
Note the line endings and beginnings.
With this change every package is printed on a new line. Package names are sorted alphabetically:
I'm assuming that the output is for human interaction only and will not be parsed by other tools?
Also, Is the order of the packages important? They are sorted alphabetically now to make packages easy to find at a glance. Should we rather display them in the order they will be upgraded?
Not sure if this change is wanted at all, but I'd be happy for ideas for improvements.